#!/bin/bash
if [[ $# != 2 ]]
then
	echo "usage: `basename $0` times command" 1>&2
	exit 1
fi

TIMES=$1
COMMAND=$2
TMP_FILE=`mktemp`

cat > $TMP_FILE

for((I=0;I<TIMES;I++))
do
	cat $TMP_FILE | eval $COMMAND | tee $TMP_FILE
done

rm $TMP_FILE
